package cn.hfjava.kz.mapper;

import cn.hfjava.kz.entity.po.Role;
import cn.hfjava.kz.entity.po.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
* @author lds
* @description 针对表【roles(角色表)】的数据库操作Mapper
* @createDate 2024-07-16 11:46:02
* @Entity cn.hfjava.kz.entity.po.Role
*/
@Mapper
public interface RoleMapper extends BaseMapper<Role> {


    @Select("select * from roles where id = #{roleId}")
    Role getRoleById(@Param("roleId") Integer roleId);

    List<User> isExistsByRoleId(Integer id);

    @Insert("insert into role_perms(roleId,permId) values(#{roleId},#{permId})")
    void bindPermission(Integer roleId, Integer permId);


    List<Integer> getPermissionIdsByRoleId(Integer id);

    List<Role> findRoleList();
}
